package com.lin.cli.command;


import cn.hutool.core.bean.BeanUtil;
import com.lin.generator.MainGenerator;
import com.lin.model.MainTemplateConfig;
import lombok.Data;
import picocli.CommandLine;

import java.beans.BeanProperty;
import java.util.concurrent.Callable;

@CommandLine.Command(name = "generate", description = "生成", mixinStandardHelpOptions = true)
@Data
public class GenerateCommand implements Callable {
    /**
     * 是否循环
     */
    @CommandLine.Option(names = {"-l", "--loop"}, description = "是否循环",interactive = true, arity = "0..1",echo = true)
    private boolean loop;

    /**
     * 作者名称
     */
    @CommandLine.Option(names = {"-a", "--author"}, description = "作者",interactive = true, arity = "0..1",echo = true)
    private String author = "lin";

    /**
     * 结果输出
     */
    @CommandLine.Option(names = {"-o", "--output"}, description = "输出",interactive = true, arity = "0..1",echo = true)
    private String output = "sum = ";

    @Override
    public Object call() throws Exception {
        MainTemplateConfig mainTemplateConfig = new MainTemplateConfig();
        BeanUtil.copyProperties(this,mainTemplateConfig);
        MainGenerator.doGenerator(mainTemplateConfig);
        return null;
    }
}
